package com.googlecode.elidom.task.service.create;

import java.util.UUID;

import net.sf.common.util.ValueUtils;

import com.googlecode.elidom.common.service.AbstractService;
import com.googlecode.elidom.task.model.Task;

public class Create extends AbstractService {
	public CreateOut create(CreateIn in) throws Exception {
		Task task = ValueUtils.populate(in, new Task());
		if (ValueUtils.isEmpty(task.getId()))
			task.setId(UUID.randomUUID().toString());
		getDml().insert(task);
		CreateOut out = new CreateOut();
		out.setTask(task);
		return out;
	}
}
